/*
 * @Description: 拦截请求，返回模拟数据
 * @Author: liushuang
 * @Date: 2022-12-06 09:48:52
 * @LastEditTime: 2022-12-06 10:47:15
 */
import Mock from 'mockjs'

Mock.setup({
  timeout: 300
})

const setResult = (data) => ({
  code: '000000',
  message: '请求成功',
  data
})

// 登录
Mock.mock('/user/login', 'post', () => setResult({
  userId: '1',
  name: '超级管理员',
  username: 'admin'
}))

// 退出登录
Mock.mock('/user/logout', 'delete', () => setResult(null))

// 获取用户信息
Mock.mock('/user/info', 'get', () => setResult({
  id: '1',
  name: '超级管理员',
  username: 'admin'
}))
